<?php 
class UserModel extends Model{
	/**
	 * 验证码 验证
	 * @param char $verify 验证码
	 */
	public function CheckVerify($verify) {
        if (md5($verify) != Session::get('verify')) return false;
        return true;
    }
	//自动验证设置
	protected $_validate = array(
        array("email", "require", "email内容不允许为空"),
        array("email", "email", "email格式不正确"),
		array('email','','邮箱已经存在！',0,'unique',1),
		array('username','','用户名已经存在！',0,'unique',1),
        array("username", "require", "姓名不允许为空"),
        //array("auth", "require", "身份不能为空"),
		//array('verify', 'CheckVerify', '验证码错误！', 0, 'callback'),
        array("password", "require", "密码不能为空"),
        array('password_repeat','password','确认密码不正确',0,'confirm'),
		array("city", "require", "城市不能为空"),
		array("county", "require", "地区不能为空"),
		array("province", "require", "省不能为空"), 
    );
    //自动填充设置
    protected $_auto = array(
        array('create_time','time',1,'function'), //注册时间        
        array('password','md5',1,'function'),
    	array('auth',1),
    );
}
?>